!pr1
AUTO/MANUAL Toggle Update for ................Robert F. O'Brien
S-C Macro Assembler Version 2.0                 Dublin, Ireland

Here is a short routine (23 bytes) which makes use of the ESC-U command option to toggle the Auto-linenumbering mode on and off readily.  The routine is relocatable so you can put it anywhere you have sufficient free space - just set the ESC-U vector to point to it, in this case :$C083 C083 D00C:4C 00 03 N C080.

When the cursor is waiting for input at the beginning of the command line, typing ESC-U will generate the command AUTO and then you have the option of entering a line number and/or RETURN.  To cancel the AUTO mode just type ESC-U while the cursor is at the beginning of the line (just after the linenumber - 4 or 5 digit line numbers are catered for).


Extended AUTO command:

The second routine, starting at $317, is just 17 bytes long and extends the AUTO command so that you can specify the increment after the starting linenumber.  For example, AUTO 3000,1 sets a starting line number of 3000 and an increment of 1.  This code is also relocatable but you must patch the first instruction in the main AUTO command so that it uses the new code as a sub- routine.  In this case it's :$C083 C083 D392:20 17 03 N C080.

The addresses specified for these new features are for the corrected version of the Assembler - i.e. serial nos. greater than 1251; see note in AAL March '85.  Here is a table of what to expect at each of the addresses used, so you can find the equivalent spots in other copies of the assembler:

!lm+5
$D198 -- 20 xx D2      (JSR GNC)
         B0 17         (BCS to RTS)
         49 30         (EOR #$30)

$D392 -- 20 xx D1      (JSR GET.VALUE)
         CA            (DEX)
         30 0E         (BMI to SEC)

$D40B -- 41 55 54 CF   (.AT /AUTO/)
         xx D3         (.DA AUTO-1)

$DB9A -- 09 80         (ORA #$80)
         9D 00 02      (STA $0200,X)
         C9 A0         (CMP #$A0)
!lm-5

Note that with the Auto/Manual Toggle function installed you won't need the MANUAL command any more, so you have a spare command if you need it!
